<%@page import="models.SolutionAdoption"%>
<%@ page import="com.googlecode.objectify.Objectify, com.googlecode.objectify.ObjectifyService, com.googlecode.objectify.Query" %>
<%@ page import = "controllers.SolutionConnect, controllers.AdoptionConnect" %>
<%@ page import = "models.SolutionSubmission, models.Location" %>
<%@ page import="java.util.*" %>


<graph xaxisname='Region' yaxisname='Count of Solutions' hovercapbg='DEDEBE' hovercapborder='889E6D' rotateNames='0' yAxisMaxValue='100' numdivlines='9' divLineColor='CCCCCC' divLineAlpha='80' decimalPrecision='0' showAlternateHGridColor='1' AlternateHGridAlpha='30' AlternateHGridColor='CCCCCC' caption='All Solutions by Region' subcaption='' >

<%

Objectify ofy = ObjectifyService.begin();
Query<Location> qLOC = ofy.query(Location.class).order("LocationRegionName");
HashSet<String> hs = new HashSet<String>(); 
for ( Location f : qLOC.fetch() ) {
	hs.add( f.getLocationRegionName() );
	
}

%>

<categories font='Arial' fontSize='11' fontColor='000000'>

<%

Iterator<String> it = hs.iterator();
String LocationName = "";

while(it.hasNext()){
	LocationName = it.next();
	out.println("<category name='" + LocationName + "' hoverText='All Solutions' link='/modules/reports/location-chart-report.jsp?region='/>");
}

%>
	
</categories>

<dataset seriesname='Shared Solutions' color='FDC12E'>

<%


it = hs.iterator();
LocationName = "";

while(it.hasNext()){
	LocationName = it.next();
	Query<SolutionSubmission> qSOL = ofy.query(SolutionSubmission.class).filter("LocationRegionName", LocationName).filter("Status", "Shared");
	out.println("<set value='"+ qSOL.countAll() +"' link='/modules/reports/location-chart-report.jsp?region=" + LocationName +"' />"); 
}

%>

</dataset>

<dataset seriesname='Adopted Solutions' color='0DE12E'>
    
<%


LocationName = "";
it = hs.iterator();

while(it.hasNext()){
	LocationName = it.next();
	Query<SolutionAdoption> qSOL = ofy.query(SolutionAdoption.class).filter("LocationRegionName", LocationName);
	out.println("<set value='"+ qSOL.countAll() +"' link='/modules/reports/location-chart-report.jsp?region=" + LocationName +"' />"); 
}

%>

</dataset>



</graph>


<!-- 





  <dataset seriesname='Shared Solutions' color='FDC12E'>
      <set value='<Computed Value>' link='frmAmericaChart?OpenForm'/>
      <set value='<Computed Value>' link='frmChinaChart?OpenForm'/>
 <set value='<Computed Value>' link='frmEuropeChart?OpenForm'/>
 <set value='<Computed Value>' link='frmPacificRimchart?OpenForm'/>
 <set value='<Computed Value>' link='frmSouth-EastAsiaChart?OpenForm'/>
</dataset>

  <dataset seriesname='Adopted Solutions' color='0DE12E'>
      <set value='<Computed Value>'link='frmAmericaChart?OpenForm'/>
      <set value='<Computed Value>'  link='frmChinaChart?OpenForm'/>
<set value='<Computed Value>' link='frmEuropeChart?OpenForm'/>
<set value='<Computed Value>'  link='frmPacificRimchart?OpenForm'/>
<set value='<Computed Value>'  link='frmSouth-EastAsiaChart?OpenForm'/>
</dataset>



 -->